Manages the sahders available in the component. More...
Public Member Functions | |
~ShaderManager () | |
bool | isBuiltInShader (Shader *toTest) |
Shader * | createOrRetrieve (const nkMemory::StringView &name) |
Shader * | get (const nkMemory::StringView &name) |
Shader * | getByIndex (unsigned int index) |
void | rename (const nkMemory::StringView &oldName, const nkMemory::StringView &newName) |
void | erase (const nkMemory::StringView &name) |
Manages the sahders available in the component.
The manager is responsible for the allocated memory it returns. External code should never delete returned memory.
nkGraphics::ShaderManager::~ShaderManager | ( | ) |
Destructor.
bool nkGraphics::ShaderManager::isBuiltInShader | ( | Shader * | toTest | ) |
Checks whether a shader is built-in, aka offered by the component as a default solution.
toTest | The shader to test. |
Shader* nkGraphics::ShaderManager::createOrRetrieve | ( | const nkMemory::StringView & | name | ) |
Creates if unavailable, or retrieve if available, a shader.
name | The name of the shader to retrieve. |
Shader* nkGraphics::ShaderManager::get | ( | const nkMemory::StringView & | name | ) |
Retrieves an existing shader.
name | The name of the shader to retrieve. |
Shader* nkGraphics::ShaderManager::getByIndex | ( | unsigned int | index | ) |
Retrieves a shader by index. Note that an index can point to different shaders as the memory of the manager is changed. Useful to loop over all available shaders in one go.
index | The index of the shader to retrieve. |
void nkGraphics::ShaderManager::rename | ( | const nkMemory::StringView & | oldName, |
const nkMemory::StringView & | newName | ||
) |
Renames a shader, changing both its name and the way to find it in the manager.
oldName | The name of the shader to alter. |
newName | The new name to assign. |
void nkGraphics::ShaderManager::erase | ( | const nkMemory::StringView & | name | ) |
Erases a shader and frees its memory.
name | The name of the shader to erase. |